{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "# -*- coding: utf-8 -*-\n",
    "\"\"\"\n",
    "Simple example using BarGraphItem\n",
    "\"\"\"\n",
    "# import initExample ## Add path to library (just for examples; you do not need this)\n",
    "\n",
    "import pyqtgraph as pg\n",
    "from pyqtgraph.Qt import QtCore, QtGui\n",
    "import numpy as np\n",
    "\n",
    "win = pg.plot()\n",
    "win.setWindowTitle('pyqtgraph example: BarGraphItem')\n",
    "\n",
    "x = np.arange(10)\n",
    "y1 = np.sin(x)\n",
    "y2 = 1.1 * np.sin(x+1)\n",
    "y3 = 1.2 * np.sin(x+2)\n",
    "\n",
    "bg1 = pg.BarGraphItem(x=x, height=y1, width=0.3, brush='r')\n",
    "bg2 = pg.BarGraphItem(x=x+0.33, height=y2, width=0.3, brush='g')\n",
    "bg3 = pg.BarGraphItem(x=x+0.66, height=y3, width=0.3, brush='b')\n",
    "\n",
    "win.addItem(bg1)\n",
    "win.addItem(bg2)\n",
    "win.addItem(bg3)\n",
    "\n",
    "\n",
    "# Final example shows how to handle mouse clicks:\n",
    "class BarGraph(pg.BarGraphItem):\n",
    "    def mouseClickEvent(self, event):\n",
    "        print(\"clicked\")\n",
    "\n",
    "\n",
    "bg = BarGraph(x=x, y=y1*0.3+2, height=0.4+y1*0.2, width=0.8)\n",
    "win.addItem(bg)\n",
    "\n",
    "# ## Start Qt event loop unless running in interactive mode or using pyside.\n",
    "# if __name__ == '__main__':\n",
    "import sys\n",
    "if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):\n",
    "    QtGui.QApplication.instance().exec_()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
